<?php
/**
 * ==============================================
 * Copy right 2015-2016 http://wei.meididi88.com
 * ----------------------------------------------
 * This is not a free software, without any authorization is not allowed to use and spread.
 * ==============================================
 * @author: hy
 * @date: 2015-9-10
 * @version: v1.0.0
 */
namespace Common\Model;

use Think\Model;

/**
 * 美容院、美容师、用户的id生成 Model模型类
 */
class AutoIdModel extends Model{
	
	protected $_auto = array(
		array('created','time',1,'function'), //新增时
	);
	
	/**
	 * 创建唯一编号
	 * @param array $data
	 * @return number|boolean
	 */
	public function createAutoId($data) {
		$data ['created'] = time();
		return $this->add($data);
	}
	
	/**
	 * 获取唯一编号的信息
	 * @param number $id	编号
	 * @return array|boolean
	 */
	public function getAutoIdInfo($id) {
		return $this->where(array('id' => $id))->find();
	}
}

?>